package com.itheima.linkedlist;

import java.util.LinkedList;

public class Demo01 {

    public static void main(String[] args) {

        LinkedList<String> list = new LinkedList<>();
        list.add("蔡徐坤1");
        list.add("蔡徐坤2");
        list.add("蔡徐坤3");
        list.add("蔡徐坤4");
        list.add("蔡徐坤5");
        list.addFirst("蔡徐坤0");
        System.out.println(list);
        list.addLast("蔡徐坤6");
        System.out.println(list);
        String first = list.getFirst();
        System.out.println(first);
        String last = list.getLast();
        System.out.println(last);
        String last2 = list.getLast();
        System.out.println(last2);
        System.out.println("-----------------------");
        String s = list.removeFirst();
        System.out.println(s);
        System.out.println(list);
        String s1 = list.removeFirst();
        System.out.println(s1);
        System.out.println(list);

        System.out.println("-----------------------");
        String s2 = list.removeLast();
        System.out.println(s2);
        System.out.println(list);
        String s3 = list.removeLast();
        System.out.println(s3);
        System.out.println(list);
    }
}
